WOLF core
WOLF: A Modular Estimation Framework for Robotics
XXXXXXXXXXXXXXXXXXXXXXXXvoid(0)" frameborder="0" name="MSearchResults" id="MSearchResults">
wolf::ProfilingUnit Class Reference

#include <core/common/profiling_unit.h>

Public Member Functions

 ProfilingUnit (double desired_period_sec=-1)
 Constructor. More...
 
void startProfiling ()
 Start profiling. More...
 
void stopProfiling ()
 Stop profiling. More...
 
void printProfiling (const std::string &_tabs, std::ostream &stream=std::cout) const
 Print profiling results. More...
 
std::string printDuration (double _duration_microsec, int precision=2) const
 Print provided duration (in us) in the most appropiate units with specified precision. More...
 
void setDesiredPeriod (double _desired_period_sec)
 Set the desired period. More...
 
bool isRunning () const
 Check if profiling is running. More...
 
unsigned int getNCallbacks () const
 Get the number of callbacks. More...
 
double getDesiredPeriod () const
 Get the desired period. More...
 
double getAveragePeriod () const
 Get the average period. More...
 
double getAccDuration () const
 Get the accumulated duration. More...
 
double getAvgDuration () const
 Get the average duration. More...
 
double getMaxDuration () const
 Get the maximum duration. More...
 
double getVarDuration () const
 Get the variance of the duration. More...
 
double getStDevDuration () const
 Get the standard deviation of the duration. More...
 

Protected Attributes

bool running_
 True if profiling is running. More...
 
double desired_period_us_
 Desired period in microseconds (< 0 for not specified) More...
 
unsigned int n_callbacks_
 Number of callbacks. More...
 
double average_period_us_
 Average period in microseconds. More...
 
std::chrono::microseconds acc_duration_us_
 Accumulated duration in microseconds. More...
 
std::chrono::microseconds max_duration_us_
 Maximum duration in microseconds. More...
 
double var_duration_us_
 Variance of the duration in microseconds squared. More...
 
std::chrono::time_point< std::chrono::high_resolution_clock > first_clock_
 Time point of the first clock. More...
 
std::chrono::time_point< std::chrono::high_resolution_clock > start_clock_
 Time point of the start clock. More...
 

Constructor & Destructor Documentation

◆ ProfilingUnit()

wolf::ProfilingUnit::ProfilingUnit ( double  desired_period_sec = -1)

Constructor.

Parameters
desired_period_secDesired period in seconds. Negative value means not specified. Default is -1.

Member Function Documentation

◆ getAccDuration()

double wolf::ProfilingUnit::getAccDuration ( ) const
inline

Get the accumulated duration.

Returns
Accumulated duration in seconds.

◆ getAveragePeriod()

double wolf::ProfilingUnit::getAveragePeriod ( ) const
inline

Get the average period.

Returns
Average period in seconds.

◆ getAvgDuration()

double wolf::ProfilingUnit::getAvgDuration ( ) const
inline

Get the average duration.

Returns
Average duration in seconds.

◆ getDesiredPeriod()

double wolf::ProfilingUnit::getDesiredPeriod ( ) const
inline

Get the desired period.

Returns
Desired period in seconds.

◆ getMaxDuration()

double wolf::ProfilingUnit::getMaxDuration ( ) const
inline

Get the maximum duration.

Returns
Maximum duration in seconds.

◆ getNCallbacks()

unsigned int wolf::ProfilingUnit::getNCallbacks ( ) const
inline

Get the number of callbacks.

Returns
Number of callbacks.

◆ getStDevDuration()

double wolf::ProfilingUnit::getStDevDuration ( ) const
inline

Get the standard deviation of the duration.

Returns
Standard deviation of the duration in seconds.

◆ getVarDuration()

double wolf::ProfilingUnit::getVarDuration ( ) const
inline

Get the variance of the duration.

Returns
Variance of the duration in seconds squared.

◆ isRunning()

bool wolf::ProfilingUnit::isRunning ( ) const
inline

Check if profiling is running.

Returns
True if profiling is running, false otherwise.

◆ printDuration()

std::string wolf::ProfilingUnit::printDuration ( double  _duration_microsec,
int  precision = 2 
) const

Print provided duration (in us) in the most appropiate units with specified precision.

Parameters
_duration_microsecDuration in microseconds.
precisionPrecision for printing the duration. Default is 2.
Returns
A string representing the duration.

◆ printProfiling()

void wolf::ProfilingUnit::printProfiling ( const std::string &  _tabs,
std::ostream &  stream = std::cout 
) const

Print profiling results.

Parameters
_tabsTabs to be used for indentation.
streamOutput stream to print the results. Default is std::cout.

◆ setDesiredPeriod()

void wolf::ProfilingUnit::setDesiredPeriod ( double  _desired_period_sec)
inline

Set the desired period.

Parameters
_desired_period_secDesired period in seconds.

◆ startProfiling()

void wolf::ProfilingUnit::startProfiling ( )

Start profiling.

◆ stopProfiling()

void wolf::ProfilingUnit::stopProfiling ( )

Stop profiling.

Member Data Documentation

◆ acc_duration_us_

std::chrono::microseconds wolf::ProfilingUnit::acc_duration_us_
protected

Accumulated duration in microseconds.

◆ average_period_us_

double wolf::ProfilingUnit::average_period_us_
protected

Average period in microseconds.

◆ desired_period_us_

double wolf::ProfilingUnit::desired_period_us_
protected

Desired period in microseconds (< 0 for not specified)

◆ first_clock_

std::chrono::time_point<std::chrono::high_resolution_clock> wolf::ProfilingUnit::first_clock_
protected

Time point of the first clock.

◆ max_duration_us_

std::chrono::microseconds wolf::ProfilingUnit::max_duration_us_
protected

Maximum duration in microseconds.

◆ n_callbacks_

unsigned int wolf::ProfilingUnit::n_callbacks_
protected

Number of callbacks.

◆ running_

bool wolf::ProfilingUnit::running_
protected

True if profiling is running.

◆ start_clock_

std::chrono::time_point<std::chrono::high_resolution_clock> wolf::ProfilingUnit::start_clock_
protected

Time point of the start clock.

◆ var_duration_us_

double wolf::ProfilingUnit::var_duration_us_
protected

Variance of the duration in microseconds squared.


The documentation for this class was generated from the following files: